package com.googlecode.autopp.conf;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.logging.Logger;

public enum ExceptionStrategyImpl implements ExceptionStrategy {
    SILENT {
        @Override
        public void handleException(Exception e) {
        }
    },

    WARN {
        @Override
        public void handleException(Exception e) {
            StringWriter sw = new StringWriter();
            e.printStackTrace(new PrintWriter(sw));
            log.warning(sw.toString());
        }
    },

    BREAK {
        @Override
        public void handleException(Exception e) {
            throw new UnsupportedOperationException("Cannot populate attribute.", e);
        }
    };

    private static final Logger log = Logger.getLogger(ExceptionStrategyImpl.class.getName());
}
